package cn.wl.basic.service.impl;

import cn.wl.basic.mapper.BaseMapper;
import cn.wl.basic.service.IBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class BaseServiceImpl<T> implements IBaseService<T>{

    @Autowired
    private BaseMapper<T> baseMapper;


    @Override
    public List<T> queryAll() {
        return baseMapper.queryAll();
    }

    @Override
    public T queryOne(Long id) {
        return baseMapper.queryOne(id);
    }

    @Override
    @Transactional
    public void save(T t) {
        baseMapper.save(t);
    }

    @Override
    @Transactional
    public void update(T t) {
        baseMapper.update(t);
    }

    @Override
    @Transactional
    public void delete(Long id) {
        baseMapper.delete(id);
    }
}
